<%@page import="form.Valider"%>
<%@page import="bean.User"%>
<%@ page import="java.rmi.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<jsp:useBean id="user" scope="request" class="bean.User" />

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Identification</title>
</head>
<body>
<%@ include file="../commun_page_swmenufree/swmenufree.jsp" %>
<jsp:include page="${pageConfig.contenu}" />
<%
if (request.getParameter("submit") != null) {
	boolean res = Valider.form(request,user);
	//out.println("validation: "+res);
	//out.println("On verifie le login et password");
	if (res){
		String username = request.getParameter("login");
	    String password = request.getParameter("password");
	    
	    if(username != null && password != null 
	    		&& Valider.isLog(username,password))
	    {    
	        session.setAttribute("username",username);
	        response.sendRedirect("../modele/modele.jsp");
	    }else{
	        out.println("<h3>Mauvais mot de passe ou login!!!!</h3>");
	    }	
	}
}
%>


<form method="post">
	<table>
	<tr>
		<td>Login : </td>
		<td><input type="text" name="login" value="${user.login}" /></td>
		<td>${user.err.login}</td>
	</tr>
	<tr>
		<td>Mot de passe : </td>
		<td><input type="password" name="password" value="${user.password}" /></td>
		<td>${user.err.password}</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><input type="submit" name="submit" value="Se connecter"/></td>
		<td></td>
	</tr>
	
	</table>
</form>


</body>
</html>